package com.example.bookstore.service;

import com.example.bookstore.common.api.CommonResult;
import com.example.bookstore.mbg.model.Book;
import com.example.bookstore.mbg.model.Chart;
import com.example.bookstore.mbg.model.Deal;
import com.example.bookstore.mbg.model.User;

import java.util.List;

/**
 * @author: rain
 * @date: 2020/5/7 11:30
 * @description:
 */
public interface UserService {


    String getValidCode(String email);
    String sendValidCode(String email);

    CommonResult register(String userid, String username,
                                 String password, String gender,
                                 String telephone,String email,
                                 String validcode);

    CommonResult login(String username, String password);

    CommonResult ModifyUserInformation(User user);

    User getUserByUserId(String userid);

    Deal getDealRecord(String userid);

    List<Book> getAllBooks(int pageNum, int pageSize);

    List<Deal> getCommentByBook(int pageNum,int pageSize,String bookid);

    //查看购物车
    List<Chart> getAllChart(int pageNum, int pageSize,String userid);

    CommonResult BuyBooksDirect(String bookid,String userid,int num,double price);

    CommonResult AddChart(String bookid, String userid);

    CommonResult AddNumInChart(int num,String userid,String bookid,String chartid);

    CommonResult DeleteFromChart(String chartid,String userid);

    CommonResult AddComment(String dealid,String userid,String text);

    List<Deal> ShowDealNeedComment();

    List<Deal> getDealByUsername(String userid);

    CommonResult getBookByBookname(String bname);

}